import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

// ignore: must_be_immutable
class AXListView extends StatelessWidget {
  List<String> list = [
    'login',
    'demo',
    '3',
  ];

  Widget _items(BuildContext context, String name) {
    ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);

    return Container(
//      color: Colors.white,
//        width: ScreenUtil().setWidth(200),
        height: ScreenUtil().setHeight(60),
        decoration: BoxDecoration(
            color: Colors.white,
            border: Border(
              bottom: BorderSide(width: 0.5, color: Colors.black26),
            )),
        child: Row(
          children: <Widget>[
            Container(
              margin: EdgeInsets.fromLTRB(10,0,5,0),
              child: Icon(Icons.home),
            ),
            Container(
              margin: EdgeInsets.zero,
              child: Text(name,style: TextStyle(fontSize: 15),),
            ),
            InkWell(
              onTap: (){
                print('点击 $name');
                Navigator.pushNamed(context,name );
              },
              child: Container(
//              padding: EdgeInsets.all(5),
//              color: Colors.brown,
                width: 50,
                decoration: BoxDecoration(
                  border: Border(
                    top: BorderSide(color: Colors.black26 ,width: 0.5 ,),
                    left: BorderSide(color: Colors.black26 ,width: 0.5 ,),
                    right: BorderSide(color: Colors.black26 ,width: 0.5 ,),
                    bottom: BorderSide(color: Colors.black26 ,width: 0.5 ,),
                  ),
                ),
                margin: EdgeInsets.only(left: 10),
                child: Text('push',style: TextStyle(fontSize: 15),textAlign: TextAlign.center,),
              ),
            ),
          ],
        ),
    );
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return ListView.builder(
      itemCount: list.length,
      itemBuilder: (context, index) {
        return InkWell(
          onTap: () {
            Navigator.pushReplacementNamed(context, list[index]);
          },
          child:_items(context, list[index]),
        );
      },
    );
  }
}
